package com.shanghaionstar.nav.adapter;

import android.content.Context;
import android.widget.TextView;

import com.onstar.cn.common.util.CommonUtil;
import com.onstar.cn.framework.annotation.FindViewById;
import com.onstar.cn.framework.base.CommonAdapter;
import com.onstar.cn.framework.base.CommonViewHolder;
import com.onstar.cn.mag.poi.FavoriteEntity;
import com.shanghaionstar.R;

import java.util.List;

/**
 * @author jun chen
 * @ClassName: NavPoiFavroiteHistoryAdapter 
 * @date 2016年3月4日 下午5:59:27 
 * @Description: 收藏历史适配器
 */
public class PoiFavroiteHistoryAdapter extends CommonAdapter<FavoriteEntity> {
	private Context context;
	private List<FavoriteEntity> list;
	private boolean reCount = false;
	
	public PoiFavroiteHistoryAdapter(List<FavoriteEntity> datas, Context context) {
		super(datas, context);
		list = datas;
		this.context = context;
	}

	@Override
	public void getView(final int position, CommonViewHolder viewHolder) {
		ViewHolder holder = (ViewHolder) viewHolder;
		String title = list.get(position).getPoiName();
		if(!CommonUtil.isNull(title)){
			holder.text_vendor_name.setText(title);
		}else{
			holder.text_vendor_name.setText("----");
		}
		String address = list.get(position).getPoiAddress();
		if(!CommonUtil.isNull(address)){
			holder.text_vendor_addres.setText(address);
		}else{
			holder.text_vendor_addres.setText("----");
		}
	}

	@Override
	public int layoutId() {
		return R.layout.nav_fav_listview_item;
	}

	@Override
	public CommonViewHolder getViewHolder() {
		return new ViewHolder();
	}

	private class ViewHolder extends CommonViewHolder {
		@FindViewById(R.id.text_vendor_name)
		TextView text_vendor_name;
		@FindViewById(R.id.text_vendor_addres)
		TextView text_vendor_addres;
	}
}
